package com.avcdata.aoscustommade.utils;

import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;

import java.text.DecimalFormat;
import java.util.ArrayList;

public class MyXDetailValueFormatter implements IAxisValueFormatter {

    private ArrayList<String> weekData;
    private DecimalFormat mFormat;

    public MyXDetailValueFormatter(ArrayList<String> weekData) {
        this.weekData = weekData;
        mFormat = new DecimalFormat("0");

    }

    @Override
    public String getFormattedValue(float value, AxisBase axis) {

//        if (value < 1 || value == weekData.size() + 1) {
//            return "";
//        }
//        return weekData.get(Integer.valueOf(mFormat.format(value - 1)) % weekData.size());

//        if (weekData.size() < 4) {
            if (value < 1 || value == weekData.size() + 1) {
                return "";
            }
            return weekData.get(Integer.valueOf(mFormat.format(value - 1)) % weekData.size());

//        } else {
//            if (value == weekData.size()) {
//                return "";
//            }
//            return weekData.get(Integer.valueOf(mFormat.format(value)) % weekData.size());
//        }
    }


}
